package com.iknow.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter;
import android.text.InputFilter.LengthFilter;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.iknow.IKnow;
import com.iknow.util.StringUtil;

public class InforEditActivity extends Activity
{
  private TextView mAccountTextView;
  private int mActionCode;
  private Button mBackButton;
  private Context mContext;
  private Spinner mGenderSpinner;
  private EditText mInfoEdit;
  private Button mSubmitBtn;
  private View.OnClickListener mSubmitBtnClickLisener;

  public InforEditActivity()
  {
    this.mSubmitBtnClickLisener = new View.OnClickListener(this)
    {
      public void onClick()
      {
        if (!(IKnow.IsNetAviable()))
          Toast.makeText(InforEditActivity.access$0(this.this$0), InforEditActivity.access$0(this.this$0).getResources().getString(2131361878), 0).show();
        while (true)
        {
          String str;
          return;
          if (InforEditActivity.access$1(this.this$0) == 2)
            str = InforEditActivity.access$2(this.this$0).getSelectedItem().toString();
          do
          {
            while (true)
            {
              this.this$0.getIntent().setAction(str);
              this.this$0.setResult(-1, this.this$0.getIntent());
              this.this$0.finish();
            }
            str = InforEditActivity.access$3(this.this$0).getText().toString();
          }
          while (((InforEditActivity.access$1(this.this$0) != 4) && (InforEditActivity.access$1(this.this$0) != 3)) || (!(StringUtil.isEmpty(str))));
          Toast.makeText(InforEditActivity.access$0(this.this$0), "请先填写", 0).show();
        }
      }
    };
  }

  private void initGenderSpinner(String paramString)
  {
    ArrayAdapter localArrayAdapter = ArrayAdapter.createFromResource(this, 2131099648, 17367048);
    localArrayAdapter.setDropDownViewResource(17367049);
    this.mGenderSpinner.setAdapter(localArrayAdapter);
    if (paramString.equalsIgnoreCase("1"))
      this.mGenderSpinner.setSelection(0);
    while (true)
    {
      while (true)
      {
        return;
        if (!(paramString.equalsIgnoreCase("0")))
          break;
        this.mGenderSpinner.setSelection(1);
      }
      this.mGenderSpinner.setSelection(2);
    }
  }

  private void initPassword(String paramString)
  {
    this.mInfoEdit = ((EditText)findViewById(2131296416));
    if (paramString.equalsIgnoreCase("111111"))
      this.mInfoEdit.setText(null);
    this.mInfoEdit.setText(getIntent().getStringExtra("data"));
    this.mAccountTextView = ((TextView)findViewById(2131296415));
    this.mAccountTextView.setVisibility(0);
    this.mInfoEdit.setInputType(129);
    this.mInfoEdit.setVisibility(0);
  }

  private void initView()
  {
    this.mActionCode = getIntent().getIntExtra("code", 0);
    switch (this.mActionCode)
    {
    case 6:
    case 7:
    case 8:
    case 9:
    case 10:
    default:
    case 3:
    case 2:
    case 4:
    case 5:
    case 11:
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            while (true)
            {
              return;
              this.mInfoEdit = ((EditText)findViewById(2131296416));
              this.mInfoEdit.setText(getIntent().getStringExtra("data"));
              this.mInfoEdit.setVisibility(0);
              InputFilter[] arrayOfInputFilter2 = new InputFilter[1];
              arrayOfInputFilter2[0] = new InputFilter.LengthFilter(20);
              this.mInfoEdit.setFilters(arrayOfInputFilter2);
            }
            this.mGenderSpinner = ((Spinner)findViewById(2131296417));
            initGenderSpinner(getIntent().getStringExtra("data"));
            this.mGenderSpinner.setVisibility(0);
          }
          initPassword(getIntent().getStringExtra("data"));
        }
        this.mInfoEdit = ((EditText)findViewById(2131296416));
        this.mInfoEdit.setText(getIntent().getStringExtra("data"));
        this.mInfoEdit.setVisibility(0);
        InputFilter[] arrayOfInputFilter1 = new InputFilter[1];
        arrayOfInputFilter1[0] = new InputFilter.LengthFilter(50);
        this.mInfoEdit.setFilters(arrayOfInputFilter1);
      }
      this.mAccountTextView = ((TextView)findViewById(2131296415));
      this.mAccountTextView.setVisibility(0);
      this.mAccountTextView.setText("请输入昵称:");
      this.mInfoEdit = ((EditText)findViewById(2131296416));
      this.mInfoEdit.setVisibility(0);
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    requestWindowFeature(1);
    setContentView(2130903077);
    this.mContext = this;
    this.mSubmitBtn = ((Button)findViewById(2131296418));
    this.mSubmitBtn.setOnClickListener(this.mSubmitBtnClickLisener);
    this.mBackButton = ((Button)findViewById(2131296342));
    this.mBackButton.setOnClickListener(new View.OnClickListener(this)
    {
      public void onClick()
      {
        this.this$0.finish();
      }
    });
    findViewById(2131296344).setVisibility(8);
    initView();
  }
}